-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
40 lines (33 loc) · 778 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
using namespace std;
int main(){
int t, r, g, b, i = 1,m, p;
string str;
cin >> t;
while(t--){
cin >> str;
cin >> r >> g >> b;
if(str == "max"){
if(r > g and r > b)
p = r;
else if(g > r and g > b)
p = g;
else
p = b;
}
else if(str == "min"){
if(r < g and r < b)
p = r;
else if(g < r and g < b)
p = g;
else
p = b;
}
else if(str == "mean")
p = (r + g + b) / 3;
else
p = (r * 0.3) + (g * 0.59) + (b * 0.11);
cout << "Caso #" << i++ << ": " << p << endl;
}
return 0;
}